import type { RouteRecordRaw } from "vue-router";
/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      hidden：        是否隐藏此路由
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 * }
 */

/**
 * 静态路由（默认路由）
 */
export const staticRoutes: Array<RouteRecordRaw> = [
  {
    path: "/login",
    name: "Login",
    component: () => import("@/views/login/index.vue"),
    meta: {
      hidden: true,
    },
  },

  {
    path: "/404",
    name: "404",
    component: () => import("@/views/error/404.vue"),
    meta: {
      hidden: true,
    },
  },
  //一级路由生成一级菜单，二级路由生成二级菜单  如果一级路由只有一个二级路由那么二级路由菜单会替代掉一级路由菜单
  {
    path: "/",
    component: () => import("@/layout/index.vue"),
    redirect: "/home",
    children: [
      {
        path: "home",
        name: "Home",
        component: () => import("@/views/home/index.vue"),
        meta: {
          title: "首页", //菜单标题
          icon: "ele-HomeFilled", //菜单图标
        },
      },
    ],
  },

  //product是个一个一级路由，它的下面有四个二级路由
  //如果一个一级路由下面有很多个二路由，那么一级路由菜单是存在的，一级菜单是需要显示标题和图标的，二级路由只需要显示标题就可以了 
  //咱们这里一级菜单的作用，是展开和收缩二级菜单
  //每一个路由都需要添加一个name命名路由，之后权限管理会用的到name的值不能乱写，首字母需要大写

  {
    path: "/product",
    component: () => import("@/layout/index.vue"),
    name:"Product",
    meta: {
      title: "商品管理", //菜单标题
      icon: "ele-Goods", //菜单图标
    },
    children: [
      {
        path: "trademark/list",
        component: () => import("@/views/product/trademark/index.vue"),
        name:"Trademark",
        meta: {
          title: "品牌管理",
        },
      },
      {
        path: "attr/list",
        component: () => import("@/views/product/attr/index.vue"),
        name:"Attr",
        meta: {
          title: "平台属性管理",
        },
      },
      {
        path: "spu/list",
        component: () => import("@/views/product/spu/index.vue"),
        name:"Spu",
        meta: {
          title: "spu管理",
        },
      },

      {
        path: "sku/list",
        component: () => import("@/views/product/sku/index.vue"),
        name:"Sku",
        meta: {
          title: "sku管理",
        },
      },
    ],
  },

  /* 匹配任意的路由 必须最后注册 */
  {
    path: "/:pathMatch(.*)",
    name: "Any",
    redirect: "/404",
    meta: {
      hidden: true,
    },
  },
];

/**
 * 定义动态路由
 */
export const allAsyncRoutes: Array<RouteRecordRaw> = [];
